package org.kent.w.base.api.dto;

import lombok.Data;

import java.io.Serializable;

/**
 * web服务返回对象
 *
 * @author wu.jigang@geely.com
 * @version 1.0
 * @Date :Created by 2020/3/2.
 */
@Data
public class WebResponseDTO<T> implements Serializable {

    private static final long serialVersionUID = 4769277245091949187L;

    private static final int SUCCESS_CODE = 0;

    private int code = SUCCESS_CODE;

    private String message;

    private T data;

    public WebResponseDTO<T> success(T data) {
        this.data = data;
        return this;
    }

    public WebResponseDTO<T> fail(int code, String message) {
        this.code = code;
        this.message = message;
        return this;
    }
}
